const bodyParser = require('body-parser');
module.exports = {
  devServer: {

    before(app) {
      app.use(bodyParser.json())
      app.post('/api/login', (req, res) => {
        const {
          username,
          password
        } = req.body;

        setTimeout(() => {
          if (username === 'admin' && password === '1234') {
            res.json({
              success: 1,
              message: "登录成功"
            })
          } else {
            res.json({
              success: 0,
              message: "用户名密码错误"
            })
          }
        }, 10000)

      })
    }
  }
}